INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PKG_NEON neon)

IF(PKG_NEON_FOUND)
    SET(NEON_INCLUDE_DIRS ${PKG_NEON_INCLUDE_DIRS})
    IF(BUILD_SHARED_LIBS)
        SET(NEON_LIBRARIES ${PKG_NEON_LIBRARIES})
    ELSE(BUILD_SHARED_LIBS)
        SET(NEON_LIBRARIES ${PKG_NEON_STATIC_LIBRARIES})
    ENDIF(BUILD_SHARED_LIBS)

ELSE(PKG_NEON_FOUND)
    FIND_PATH(NEON_INCLUDE_DIRS ne_request.h
        PATHS
        ${PKG_NEON_INCLUDE_DIRS}
        /usr/include
        /usr/local/include
        PATH_SUFFIXES neon
    )

    FIND_LIBRARY(NEON_LIBRARIES neon
        ${PKG_NEON_LIBRARY_DIRS}
        /usr/lib
        /usr/local/lib
    )

    FIND_PACKAGE_HANDLE_STANDARD_ARGS(Neon DEFAULT_MSG NEON_LIBRARIES NEON_INCLUDE_DIRS)
ENDIF(PKG_NEON_FOUND)